package com.wy2.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wy2.entity.Follow;
import com.wy2.entity.Message;
import com.wy2.mapper.MessageMapper;
import com.wy2.service.MessageService;
import com.wy2.util.FenyeUtil;
@Service
public class MessageServiceImpl implements MessageService {
@Autowired
private MessageMapper messageMapper;
     /**
      * 添加
      */
	@Override
	public Integer addMessage(Message message) {
		// TODO Auto-generated method stub
		return messageMapper.addMessage(message);
	}
	/**
	 * 分页查询
	 */
	@Override
	public FenyeUtil<Message> getAll(FenyeUtil<Message> fenye) {
		Integer count = messageMapper.getCount(fenye);
		List<Message> data = messageMapper.getData(fenye);
		if(data.size()>0) {
			fenye.setCount(count);
			fenye.setData(data);
		}else {
			fenye.setCode(1);
			fenye.setMsg("无数据");
		}
		return fenye;
	}

}
